/**
 * APP 权限相关方法
 */
import permision from "@/js_sdk/wa-permission/permission.js"

/**
 * 获取当前手机是否开启或关闭了定位服务
 */
export const checkSystemEnableLocation = () => {
	// #ifdef APP-PLUS
	return permision.checkSystemEnableLocation()
	// #endif
}

// 打开当前APP权限设置界面
export const gotoAppPermissionSetting = () => {
	// #ifdef APP-PLUS
	return permision.gotoAppPermissionSetting()
	// #endif
}

/**
 * permisionID 获取安卓权限
 * https://ext.dcloud.net.cn/plugin?id=594
 * permision.requestAndroidPermission(permisionID)返回值为数字，包括-1、0、1这3个数字。
 */
export const requestAndroidPermission = async (permisionID) => {
	// #ifdef APP-PLUS
	var result = await permision.requestAndroidPermission(permisionID)
	var strStatus
	if (result == 1) {
		strStatus = "已获得授权"
	} else if (result == 0) {
		strStatus = "未获得授权"
	} else {
		strStatus = "被永久拒绝权限"
	}
	return result
	// #endif
}